from PIL import Image
import os
import datetime



def crop_img_percentage(box,image):

    w_pixel=image.size[0]
    print(image.size)
    h_pixel=image.size[1]
    x_left_pixel = w_pixel*box[0]
    y_left_pixel = h_pixel*box[1]
    crop_w_pixel = w_pixel * box[2]
    crop_h_pixel = h_pixel * box[3]
    crop_img = image.crop((x_left_pixel, y_left_pixel,x_left_pixel+ crop_w_pixel,y_left_pixel+ crop_h_pixel))
    #img2.show()
    return crop_img

def get_percentage_list(box_dic):
    box_list=[]
    box_list.append(box_dic['leftX']/100)
    box_list.append(box_dic['leftY']/100)
    box_list.append(box_dic['xLength']/100)
    box_list.append(box_dic['yLength']/100)
    return box_list


import numpy as np
if __name__ == '__main__':
    a=np.array([])
    print(type(a.size))
    #print(a==[])
    if a.size==0:
        print("yes")
